package com.ssy.lingxi.marketing.model.constant;

import java.util.Arrays;

/**
 /**
 * 活动商品数量校验-操作类型
 * @author ds
 * @date 2021/6/18
 * @version 2.0.0
 */
public enum GoodsQuantityCheckTypeEnum {
    ALL(0,"未知"),
    ADD_TO_CART(1, "加入进货单"),
    BUY(2, "立即购买"),
    ADJUST_NUM(3, "进货单数量调整"),
    CALCULATE_PRICE(4, "用户端计算活动到手价"),
    CALCULATE_PRICE_FEIGN(5, "Feign计算活动到手价"),
    ;

    private final Integer code;
    private final String message;

    GoodsQuantityCheckTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String getMessage(Integer code) {
        return Arrays.stream(GoodsQuantityCheckTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL).getMessage();
    }
    public static GoodsQuantityCheckTypeEnum find(Integer code) {
        return Arrays.stream(GoodsQuantityCheckTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


}
